# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
    # Pick a unique cookie name to distinguish our session data from others'
    session :session_key => '_xmpp-psn_session_id'

    def rescue_action_in_public(exception)
        case exception
            when ActiveRecord::RecordNotFound, ::ActionController::UnknownAction
                #write_exception_to_file(exception) if should_write_exception_to_file?(exception)
                puts exception
                #render :file => 'public/404.html', :status => 404
            when ::ActionController::RoutingError
                #redirect_to :controller => 'error', :action => 404
            when ::ActionController::DoubleRenderError
                SystemNotifier.deliver_exception_notification(self, request, exception, @own_profile)
            else
                puts exception
                #write_exception_to_file(exception)
                #render :template => 'error/500', :status => 500
        end
    end
end
